<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>   
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>  
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>  
<%@ taglib uri="http://shiro.apache.org/tags" prefix="shiro" %>       
<c:set var="ctx" value="${pageContext.request.contextPath}"/> 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<jsp:include page="../include.jsp"/>
<script type="text/javascript">
	
	$(function() {
		parent.$.messager.progress('close');
		$('#form').form({
			url : '${ctx}/machInfo/addMachInfo',
			onSubmit : function() {
				validate = $(this).form('validate');	
				if(validate){
					return true;
				}else{
					return false;
				}				
			},
			success : function(result) {
				parent.$.messager.progress('close');
				result = $.parseJSON(result);
				if(result.success) {
					parent.$.modalDialog.openner_dataGrid.datagrid('load');
					parent.$.modalDialog.handler.dialog('close');
					parent.$.messager.alert('系统提示', result.msg, 'info');
				} else {
					parent.$.messager.alert('错误', result.msg, 'error');
				}
			}
		});
	});
		
	
</script>
</head>
<body>
	<div class="easyui-layout" data-options="fit:true,border:false">
		<div data-options="region:'center',border:false" title="" style="overflow: hidden;">			
			<form id="form" method="post">
				<input name="machId" type="hidden" value="${machId}">
	            <div style="margin-bottom:5px;padding-top:30px;padding-left:10%">
	                <input labelAlign="right" class="easyui-textbox" name="machNum" value="${machInfo.machNum}" style="width:60%" data-options="label:'机台编号:',required:true">
	            </div>	
	            <div style="margin-bottom:5px;padding-left:10%">
	                <input labelAlign="right" class="easyui-textbox" name="machName" value="${machInfo.machName}" style="width:60%" data-options="label:'机台名称:',required:true">
	            </div>
	            <div style="margin-bottom:5px;padding-left:10%">
	                <input labelAlign="right" class="easyui-textbox" name="ip" value="${machInfo.ip}" style="width:40%;" data-options="label:'机台ip:',required:true,validType:'ip'">
	            </div>
	            <div style="margin-bottom:5px;padding-left:10%">
	           		<select class="easyui-combobox" id="machType" name="machType" validType="selectValueRequired['#machType']" labelAlign="right" label="系统型号:"labelPosition="left" editable="false" style="width:40%;">
						<option value="">-请选择-</option>							
						<c:forEach items="${dictMachTypeItems}" var="item">
							<option value="${item.itemValue}" <c:if test="${machInfo.machType==item.itemValue}">selected = "selected"</c:if>>${item.itemText}</option>
						</c:forEach>
					</select>
	            </div>	
	            <div style="margin-bottom:5px;padding-left:10%">
	           	      <label style="text-align: right"  class="textbox-label textbox-label-after textbox-label-checked">是否停用:</label>
			          <c:if test="${not empty machId}">
			          	<input class="easyui-radiobutton" name="activate" value="1" label="启用" labelWidth="80px" labelPosition="after" <c:if test="${machInfo.activate=='1'}">checked="true"</c:if> >
			          	<input class="easyui-radiobutton" name="activate" value="0" label="停用" labelWidth="80px" labelPosition="after" <c:if test="${machInfo.activate=='0'}">checked="true"</c:if> >		          	
			          </c:if>
			           <c:if test="${empty machId}">
			          	<input class="easyui-radiobutton" name="activate" value="1" label="启用" labelWidth="80px" labelPosition="after" checked="true">
			          	<input class="easyui-radiobutton" name="activate" value="0" label="停用" labelWidth="80px" labelPosition="after" >		          	
			          </c:if>
			     </div>	            
	        </form>
		</div>
	</div>
</body>
</html>